{% macro userInfo(user, isMe, isMeFollow) %}

<div class="user-info">
  <div class="user-title">
    <img src="{{user.avatar}}" alt="" width="80" height="80" style="border-radius: 50%">
    <span>{{user.nickName}}</span>
  </div>
  {% if isMe %}
  <a href="##">@提到我的(999+)</a>
  {% else %} {% if isMeFollow %}

  <button class="unfollow">取消关注</button>

  {% else %}
  <button class="follow">关注</button>
  {% endif %} {% endif %}
</div>
<hr>

<script>
  $(".follow").click(function () {
    // 获取被关注人的id followerId
    const followerId = '{{user.id}}';
    ajax.post(
      "/api/porfile/follow",
      { followerId },
      function (err, data) {
        if (err) {
          alert(err);
          return;
        }
        alert("关注成功");
        // 刷新页面
        location.href = "";
      })
  })

  $(".unfollow").click(function () {
    // 获取被关注人的id followerId
    const followerId = '{{user.id}}';
    ajax.post(
      "/api/profile/unFollow",
      { followerId },
      function (err, data) {
        if (err) {
          alert(err);
          return;
        }
        alert("取消关注成功");
        // 刷新页面
        location.href = "";
      })
  })
</script> {% endmacro %}